#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <set>

using namespace std;

void Test1()
{

}

int _max(int h, int a, int H, int A)
{
    int sum = 0;
    if (a > H) return -1;


    while (h > 0)
    {
        int h1 = H;
        while (h > 0 && h1 > 0)
        {
            h1 -= a;
            if (h1 > 0) h -= A;
        }
        if (h > 0) sum++;
    }

    return sum;
}

int main()
{
    int n; cin >> n;
    int h, a, H, A;
    while (n--)
    {
        cin >> h >> a >> H >> A;
        cout << _max(h, a, H, A) << endl;
    }

    return 0;
}


int main() {
    int n;  cin >> n;
    vector<string> v(n);
    for (int i = 0; i < n; i++)
    {
        cin >> v[i];
    }

    set<string> s;
    for (int i = 0; i < v.size(); i++)
    {
        sort(v[i].begin(), v[i].end(), greater<int>());
        s.insert(v[i]);
    }

    cout << s.size() << endl;

    return 0;
}

